<template>
<h1>双向绑定</h1>

  {{info}}<input type="text" v-model="info">
  <hr>
  <h3>登录页面</h3>
  <input type="text" placeholder="请输入用户名" v-model='user.username'>
  <input type="text" placeholder="请输入密码" v-model='user.password'>
  <br>
  性别:
  <input type="radio" name="gender" value="1" v-model="user.gender">男
  <input type="radio" name="gender" value="0" v-model="user.gender">女<br>
  <button @click="f()">立即注册</button>
</template>

<script setup>
  import {ref} from "vue";
  const info = ref('')
  const user = ref({username:"" , password:"", gender: "1"});
  const  f = ()=>{
    console.log(user.value.username);
    console.log(user.value.password);
    console.log(user.value.gender);
  }
</script>

<style scoped>

</style>